home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C18 / FileClass.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  517 b   |  22 lines

  1. //: C18:FileClass.cpp {O}
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Implementation
  7. #include "FileClass.h"
  8. #include <cstdlib>
  9. using namespace std;
  10.  
  11. FileClass::FileClass(const char* fname, const char* mode){
  12.   f = fopen(fname, mode);
  13.   if(f == NULL) {
  14.     printf("%s: file not found\n", fname);
  15.     exit(1);
  16.   }
  17. }
  18.  
  19. FileClass::~FileClass() { fclose(f); }
  20.  
  21. FILE* FileClass::fp() { return f; } ///:~
  22.